using System;

namespace PoliceBase
{
    public class Node
    {
        #region DataFields
        private int _x;
        private int _y;
        private int _id;
        #endregion

        #region Properties
        public int X
        {
            get { return _x; }
        }
        public int Y
        {
            get { return _y; }
        }
        public int ID
        {
            get { return _id; }
        }
        #endregion

        #region Constructors
        public Node()
        {
            this._x = -1;
            this._y = -1;
        }
        public Node(string node)
        {
            string[] strs = node.Split(',');
            this._x = Convert.ToInt32(strs[0]);
            this._y = Convert.ToInt32(strs[1]);
        }
        public Node(int x, int y)
        {
            this._x = x;
            this._y = y;
            this._id = -1;
        }
        public Node(int x, int y, int id)
        {
            this._x = x;
            this._y = y;
            this._id = id;
        }
        #endregion

        #region PublicMethods
        public override string ToString()
        {
            return (this._x.ToString() + "," + this._y.ToString());
        }
        public static double GetDistance(Node node1, Node node2)
        {
            return Math.Sqrt(Math.Pow(node1._x - node2._x, 2) + Math.Pow(node1._y - node2._y, 2));
        }
        #endregion
    }
}
